<?php
namespace Tbf\Third\Pay\Alipay;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventDispatcher;

/**
 * @deprecated
 */
class Alipay
{
    protected $dispatcher=null;
    protected $config = array();
    /**
    * @param $dispatcher 事件管理器
    * @param $config 支付宝配置
config struct{
    seller_email 商家在支付宝注册的邮箱
    partner_id 商家的交易id
    key        商家的支付宝密钥
    return_url 用户页面支付完成后返回的url
    notify_url 支付宝消息的url
}
    */
    public function __construct($config,EventDispatcherInterface $dispatcher=null)
    {
        if ($dispatcher!==null) {
            $this->dispatcher = $dispatcher;
        } else {
            $this->dispatcher = new EventDispatcher;
        }
        $this->config = $config;
    }
    public function getCreateDirectPayByUser()
    {
        $config = array(
            'seller_email'=>'cxxx',
            'partner_id'=>'xxxxxxx',
            'key'=>'xxxxxxx',
            'return_url'=>'http://fruit.sxz.dashu.us/index.php?model=payment&action=preturn&code=alipay',
            'notify_url'=>'http://fruit.sxz.dashu.us/index.php?model=payment&action=pnotify&code=alipay'
            );

        return new CreateDirectPayByUser($this->config,$this->dispatcher);
    }
}
